package covertjava.visibility;
import java.awt.*;
import covertjava.chat.MainFrame;

/**
 * <p>Gives public access to protected/package class members</p>
 * <p>Copyright: Copyright (c) 2004 Sams Publishing</p>
 * @author Alex Kalinovsky
 * @version 1.0
 */
public class PackageAccessTest {

    public static void main(String[] args) throws Exception {
        System.out.println("Testing package-visible access");
        Container container = createTestContainer();
        if (container.getLayout() instanceof BorderLayout) {
            BorderLayout layout = (BorderLayout)container.getLayout();
            Component center = AwtHelper.getChild(layout, BorderLayout.CENTER);
            System.out.println("Center component = " + center);
        }
        else
            System.out.println("Container does not use BorderLayout");

    }

    public static Container createTestContainer() throws Exception {
        MainFrame frame = new MainFrame(false);
        return frame.getContentPane();
    }
}
